
********************************************************************************
* WHAT: Do file that replicates the tables and figures for:
*		"Who Hosts? The Correlates of Hosting the Internally Displaced"
*		by Leonid Peisakhin, Nik Stoop, Peter van der Windt
*		American Political Science Review

* WHEN: Version June 2024

* DATA: Uses three databases
*		"Dataset_replication.dta"  		- main database
*		"DatasetDyad_replication.dta" 	- dyad-level database 
*		"DatasetQual_replication.dta" 	- database qualitative follow-up
********************************************************************************



***************************
* Housekeeping
***************************

	clear all 
	set more off
	set scheme s1mono
	graph set window fontface "Latin Modern Roman"
	
	* Set your working directory
	* cd "YOUR LOCAL PATH TO THE REPLICATION FOLDER"
	
	
***************************
* Figure 1: Map of research area
***************************

	* see paper 
		
***************************
* Table 1: Descriptive Information on Potential Hosting Households
***************************

	use "03_Dataset_replication.dta",clear
	
	* demographics potential hosts
	sum q105_resp_age literate q37_bornvillage protestant catholic other_rel q33_hhsize dependency_ratio visit3_hosting 

	* empathy
	sum emp_index q61_sad_03 q62_caughtup_03 q63_scared_03 q65_understand_03 q66_angry_03      
		
	* ethnicity
	sum havu_head shi_head tembo_head ethnic_index q98_similar_03 q99_attachment_03 q100_insult_03 
		
	* authority 
	sum q58_rel_chief 
		
	* perceived benefits
	sum q103_aid_sagree q104_cheaplabor_sagree
		
	* wealth 
	sum good_roof good_walls asset_index
		
	* religiosity 
	sum q53_opinion q50_timeschurch
		
	* male head 
	sum male_head
				
	* exposure to violence 
	sum exposure_violence q48_fear q47_armed_groups q46_armed_violence q43_home_ransacked q45_kidnapped q44_phys_attack  
		
***************************
* Table 2: Correlates of hosting - columns 1-3
***************************

	use "03_Dataset_replication.dta",clear

	local empathy "std_emp_index"
	local groupid "std_ethnic_index"
	local chief "std_q58_rel_chief"
	local benefit "std_q103_aid_sagree std_q104_cheaplabor_sagree"
	local wealth "std_good_roof std_good_walls std_asset_index"
	local religiosity "std_q53_opinion std_q50_timeschurch"
	local security "std_male_head"
	local violence "std_q43_home_ransacked"
	local demograph "std_visit3_hosting std_q105_resp_age std_literate std_q37_bornvillage std_protestant std_q33_hhsize std_dependency_ratio"

	eststo clear	
	eststo: reg std_visit5or6_hosting_dk `empathy' `groupid' `chief' `benefit' `wealth' `religiosity' `security' `violence', vce(cl IDV)	
	eststo: areg std_visit5or6_hosting_dk `empathy' `groupid' `chief' `benefit' `wealth' `religiosity' `security' `violence', absorb(IDV) vce(cl IDV)	
	eststo: areg std_visit5or6_hosting_dk `empathy' `groupid' `chief' `benefit' `wealth' `religiosity' `security' `violence' `demograph', absorb(IDV) vce(cl IDV)	
	
	esttab using "Table2a.rtf", replace b(%6.3f) se(%6.3f) star(* 0.10 ** 0.05 *** 0.01) drop(_cons) nogaps label r2 
		
***************************
* Table 2: Correlates of hosting - column 4 dyad-level
***************************
	
	use "04_DatasetDyad_replication.dta",clear 
	
	eststo clear 
	eststo: areg std_dyad_hosting std_emp_index dyad_sameethnicity_resp std_q58_rel_chief std_q103_aid_sagree std_q104_cheaplabor_sagree std_good_roof std_good_walls std_asset_index std_q53_opinion std_q50_timeschurch std_male_head std_q43_home_ransacked std_visit3_hosting std_q105_resp_age std_literate std_q37_bornvillage std_protestant std_q33_hhsize std_dependency_ratio, absorb(IDV_IDP) vce(cl IDV_house)	

	esttab using "Table2b.rtf", replace b(%6.3f) se(%6.3f) star(* 0.10 ** 0.05 *** 0.01) drop(_cons) nogaps label r2	

***************************
* Figure 2: Reasons for hosting 
***************************
	
	use "05_DatasetQual_replication.dta",clear 
	
	graph hbar (mean) empathy (mean) familyfriend (mean) authority (mean) morality (mean) goodfamily , legend(off) blabel(bar,format(%9.2f)) ylabel(0(0.2)0.8) ytitle("Proportion of respondents")  ascategory yvar(relabel(1"Empathy" 2"Family / friend" 3"Authority" 4"Morality" 5"Good family" 6"Labor"))  
	
	graph export "Fig2.pdf",replace
	
***************************
* Table 3: Correlates of Empathy
***************************

	use "03_Dataset_replication.dta",clear

	local groupid "std_ethnic_index"
	local chief "std_q58_rel_chief"
	local benefit "std_q103_aid_sagree std_q104_cheaplabor_sagree"
	local wealth "std_good_roof std_good_walls std_asset_index"
	local religiosity "std_q53_opinion std_q50_timeschurch"
	local security "std_male_head"
	local demograph "std_visit3_hosting std_q105_resp_age std_literate std_q37_bornvillage std_protestant std_q33_hhsize std_dependency_ratio"
	
	eststo clear	
	eststo: areg std_emp_index std_exposure_violence `groupid' `chief' `benefit' `wealth' `religiosity' `security' `demograph', absorb(IDV) vce(cl IDV)		
	eststo: areg std_emp_index std_q43_home_ransacked `groupid' `chief' `benefit' `wealth' `religiosity' `security' `demograph', absorb(IDV) vce(cl IDV)	
	eststo: areg std_emp_index std_q40_displaced `groupid' `chief' `benefit' `wealth' `religiosity' `security' `demograph' , absorb(IDV) vce(cl IDV)	
		
	esttab using "Table3.rtf", replace b(%6.3f) se(%6.3f) star(* 0.10 ** 0.05 *** 0.01) drop(_cons) nogaps label r2 order(std_exposure_violence std_q43_home_ransacked std_q40_displaced) 

***************************
* Table 4: Results of experiment 
***************************
	
	use "03_Dataset_replication.dta",clear
		
	eststo clear
	eststo: areg list_accept T_empathy T_authority T_morality  other_ethnicity T_empathy_OTHER T_authority_OTHER T_morality_OTHER i.enumerator, absorb(IDV) vce(cl IDV)
	eststo: areg visit5or6_hosting_dk T_empathy T_authority T_morality  other_ethnicity T_empathy_OTHER T_authority_OTHER T_morality_OTHER i.enumerator, absorb(IDV) vce(cl IDV)
		
	esttab using "Table4.rtf", replace b(%6.3f) r2 se(%6.3f) star(* 0.10 ** 0.05 *** 0.01) drop(_cons) nogaps label
			

******************************************************************************** 
*** APPENDIX
********************************************************************************	
	
***************************
* Figure A1: Reasons for hosting and for being hosted 
***************************	
	
	use "05_DatasetQual_replication.dta",clear 
	
	* Panel A. Reasons for Hosting and for Being Hosted
	graph hbar (mean) empathy (mean) familyfriend (mean) authority (mean) morality (mean) goodfamily (mean) labor , legend(off) blabel(bar,format(%9.2f)) ylabel(0(0.2)0.8) ytitle("Proportion of respondents")  ascategory yvar(relabel(1"Empathy" 2"Family / friend" 3"Authority" 4"Morality" 5"Good family" 6"Labor")) subtitle("Panel A: Reasons for Hosting") fxsize(80)	
	graph save one,replace
	
	
	* Panel B. Reasons for Hosting and for Being Hosted
	graph hbar (mean) empathy2 (mean) familyfriend2 (mean) authority2 (mean) morality2 (mean) goodfamily2 (mean) labor2, legend(off) blabel(bar,format(%9.2f)) ylabel(0(0.2)0.8) ytitle("Proportion of respondents")  ascategory yvar(relabel(1"Empathy" 2"Family / friend" 3"Authority" 4"Morality" 5"Good family" 6"Labor")) subtitle("Panel B: Reasons for Being Hosted") fxsize(80)
	graph save two,replace
	
	graph combine "one.gph" "two.gph", ycommon xcommon imargin(zero)
	graph export "FigureA1.png",replace	
	erase "one.gph" 
	erase "two.gph"	


***************************
* Table A1: Willingness to host members of the same and other ethnic groups  
***************************
	
	use "05_DatasetQual_replication.dta",clear 
	
	summ host* if resp_language==3 
	*tembo	
	summ host* if resp_language==1 
	*havu 
	summ host* if resp_language==2 
	*shi
	summ host* if resp_language==4 
	*hunde 


***************************
* Figure A2: Mentioned criteria for hosting 
***************************	
	
	use "05_DatasetQual_replication.dta",clear 
	
	graph hbar (mean) empathy3 (mean) goodfamily3 (mean) ethnicity3 (mean) small3  (mean) morality3 (mean) authority3 (mean) familyfriend3 (mean) labor3 , legend(off) blabel(bar,format(%9.2f)) ylabel(0(0.2)0.8) ytitle("Proportion of respondents") ascategory yvar(relabel(1"Empathy / no discrimination" 2"Good family" 3 "Ethnicity" 4 "Small family" 5 "Morality" 6"Authority" 7"Family / friend" 8"Labor"))	

	graph export "FigureA2.png",replace
	
	
***************************
* Figure A3: Confirmatory factor analysis model
***************************	

	use "03_Dataset_replication.dta",clear
	
	sem (Affective@1 -> q61_sad, ) (Affective -> q62_caughtup, ) (Affective -> q63_scared, ) (Cognitive@1 -> q65_understand, ) (Cognitive -> q66_angry, ), covstruct(_lexogenous, diagonal) method(mlmv) standardized latent(Affective Cognitive ) cov( Affective*Cognitive) nocapslatent
	

***************************
* Table A4: Robustness tests 
***************************		

	use "03_Dataset_replication.dta",clear
	
	local empathy "std_emp_index"
	local groupid "std_ethnic_index"
	local chief "std_q58_rel_chief"
	local benefit "std_q103_aid_sagree std_q104_cheaplabor_sagree"
	local wealth "std_good_roof std_good_walls std_asset_index"
	local religiosity "std_q53_opinion std_q50_timeschurch"
	local security "std_male_head"
	local violence "std_q43_home_ransacked"
	local demograph "std_visit3_hosting std_q105_resp_age std_literate std_q37_bornvillage std_protestant std_q33_hhsize std_dependency_ratio"
	
	eststo clear	
	eststo: areg std_visit5or6_hosting_dk `empathy' `groupid' `chief' `benefit' `wealth' `religiosity' `security' `violence' `demograph' , absorb(IDV) vce(cl IDV)	
	eststo: areg std_dwellinghosts_10m_dk `empathy' `groupid' `chief' `benefit' `wealth' `religiosity' `security' `violence'  `demograph' , absorb(IDV) vce(cl IDV)	
	eststo: areg std_visit5or6_hosting_dk `empathy' `groupid' `chief' `benefit' `wealth' `religiosity' `security' `violence' `demograph' if visit3_hosting==0, absorb(IDV) vce(cl IDV)	
	eststo: areg std_visit5or6_hosting_dk `empathy' `groupid' `chief' `benefit' `wealth' `religiosity' `security' `violence' `demograph' if visit7_hhleft_during10m==0, absorb(IDV) vce(cl IDV)	
	eststo: areg std_totalhosted `empathy' `groupid' `chief' `benefit' `wealth' `religiosity' `security' `violence' `demograph', absorb(IDV) vce(cl IDV)	
	eststo: areg std_visit5or6_hosting `empathy' `groupid' `chief' `benefit' `wealth' `religiosity' `security' `violence' `demograph' std_knewbefore2, absorb(IDV) vce(cl IDV)	
	
	esttab using "TableA4.rtf", replace b(%6.3f) se(%6.3f) star(* 0.10 ** 0.05 *** 0.01) drop(_cons) nogaps label r2					


	 
***************************
* Table A5: Wild cluster bootstrapped standard errors
***************************
		
	use "03_Dataset_replication.dta",clear
		
	local empathy "std_emp_index"
	local groupid "std_ethnic_index"
	local chief "std_q58_rel_chief"
	local benefit "std_q103_aid_sagree std_q104_cheaplabor_sagree"
	local wealth "std_good_roof std_good_walls std_asset_index"
	local religiosity "std_q53_opinion std_q50_timeschurch"
	local security "std_male_head"
	local violence "std_q43_home_ransacked"
	local demograph "std_visit3_hosting std_q105_resp_age std_literate std_q37_bornvillage std_protestant std_q33_hhsize std_dependency_ratio"

	eststo clear	
	eststo main: xi: reg std_visit5or6_hosting_dk `empathy' `groupid' `chief' `benefit' `wealth' `religiosity' `security' `violence' `demograph' i.IDV, cluster(IDV)	
		
	* Run regressions & get bootstrapped s.e. in loop
	local est "main"
	foreach y of local est{
		est restore `y'
		* Run boottest to get bootstrapped clustered pvals and CIs for all coefficients
		local indep_vars:colnames e(b)
		local n_vars: colsof e(b)
		local indep_hypotheses
		foreach var of local indep_vars {
			local indep_hypotheses = "`indep_hypotheses' {`var'}"
		}
		boottest `indep_hypotheses',cluster(IDV) nograph weight(webb) seed(0123) 
		*boottest each coefficient
		* Store boottest output in e() matrices
		matrix boot_pval  = J(1,`n_vars',.)
		forval k = 1/`n_vars' { 
			*Loop through predictors, aka matrix columns
			matrix boot_pval[1,`k'] = r(p_`k')
		}
		foreach mat in "boot_pval"{
			matrix colnames `mat' = `indep_vars'
			estadd matrix `mat' = `mat': `y'
		}
	}
	* Output boottest
	esttab main using "TableA5.rtf", cells(b(star pvalue(boot_pval) fmt(3)) p(fmt(3)par) boot_pval(fmt(3)par([ ]))) replace star(* 0.10 ** 0.05 *** 0.01) nogaps label drop(_cons) stats(N r2_p,fmt(%9.0fc %9.3f)) 
	
***************************
* Table A6: Correlates of hosting 
***************************	

	use "03_Dataset_replication.dta",clear
	
	local empathy "std_emp_index"
	local groupid "std_ethnic_index"
	local chief "std_q58_rel_chief"
	local benefit "std_q103_aid_sagree std_q104_cheaplabor_sagree"
	local wealth "std_good_roof std_good_walls std_asset_index"
	local religiosity "std_q53_opinion std_q50_timeschurch"
	local security "std_male_head"
	local violence "std_q43_home_ransacked"
	local demograph "std_visit3_hosting std_q105_resp_age std_literate std_q37_bornvillage std_protestant std_q33_hhsize std_dependency_ratio"

	
	eststo clear	
	eststo: reg std_visit5or6_hosting_dk `empathy' `groupid' `chief' `benefit' `wealth' `religiosity' `security' `violence', vce(cl IDV)	
	eststo: areg std_visit5or6_hosting_dk `empathy' `groupid' `chief' `benefit' `wealth' `religiosity' `security' `violence', absorb(IDV) vce(cl IDV)		
	eststo: areg std_visit5or6_hosting_dk `empathy' `groupid' `chief' `benefit' `wealth' `religiosity' `security' `violence' `demograph', absorb(IDV) vce(cl IDV)	
	eststo: areg std_visit5or6_hosting_dk `empathy' `groupid' `chief' `benefit' `wealth' `religiosity' `security' `violence' `demograph' T_empathy T_authority T_morality other_ethnicity T_empathy_OTHER T_authority_OTHER T_morality_OTHER, absorb(IDV) vce(cl IDV)	
	eststo: areg std_visit5or6_hosting_dk std_emp_index_aff `groupid' `chief' `benefit' `wealth' `religiosity' `security' `violence' `demograph', absorb(IDV) vce(cl IDV)	
	eststo: areg std_visit5or6_hosting_dk std_emp_index_cog `groupid' `chief' `benefit' `wealth' `religiosity' `security' `violence' `demograph', absorb(IDV) vce(cl IDV)	
	
	esttab using "TableA6.rtf", replace b(%6.3f) se(%6.3f) star(* 0.10 ** 0.05 *** 0.01) drop(_cons) nogaps label r2 order(std_emp_index std_emp_index_aff std_emp_index_cog)
		
		
		
***************************
* Table A7: Correlates of hosting - Parsimonious model 
***************************

	use "03_Dataset_replication.dta",clear

	eststo clear		
	eststo: areg std_visit5or6_hosting_dk std_emp_index, absorb(IDV) vce(cl IDV)		
	eststo: areg std_visit5or6_hosting_dk std_ethnic_index, absorb(IDV) vce(cl IDV)	
	eststo: areg std_visit5or6_hosting_dk std_q58_rel_chief, absorb(IDV) vce(cl IDV)	
	eststo: areg std_visit5or6_hosting_dk std_q103_aid_sagree std_q104_cheaplabor_sagree, absorb(IDV) vce(cl IDV)	
	eststo: areg std_visit5or6_hosting_dk std_good_roof std_good_walls std_asset_index, absorb(IDV) vce(cl IDV)	
	eststo: areg std_visit5or6_hosting_dk std_q53_opinion std_q50_timeschurch, absorb(IDV) vce(cl IDV)	
	eststo: areg std_visit5or6_hosting_dk std_exposure_violence, absorb(IDV) vce(cl IDV)	
	eststo: areg std_visit5or6_hosting_dk std_q43_home_ransacked, absorb(IDV) vce(cl IDV)		
	eststo: areg std_visit5or6_hosting_dk std_male_head, absorb(IDV) vce(cl IDV)	
	esttab using "TableA7.rtf", replace b(%6.3f) se(%6.3f) star(* 0.10 ** 0.05 *** 0.01) drop(_cons) nogaps label r2	
	
	
	
***************************
* Table A8: Correlates of hosting - Dyad level  
***************************

	use "04_DatasetDyad_replication.dta",clear 
	
	eststo clear 
	
	eststo: areg std_dyad_hosting std_emp_index std_ethnic_index std_q58_rel_chief std_q103_aid_sagree std_q104_cheaplabor_sagree std_good_roof std_good_walls std_asset_index std_q53_opinion std_q50_timeschurch std_male_head std_q43_home_ransacked std_visit3_hosting std_q105_resp_age std_literate std_q37_bornvillage std_protestant std_q33_hhsize std_dependency_ratio, absorb(IDV_IDP) vce(cl IDV_house)	

	eststo: areg std_dyad_hosting std_emp_index dyad_sameethnicity_resp std_q58_rel_chief std_q103_aid_sagree std_q104_cheaplabor_sagree std_good_roof std_good_walls std_asset_index std_q53_opinion std_q50_timeschurch std_male_head std_q43_home_ransacked std_visit3_hosting std_q105_resp_age std_literate std_q37_bornvillage std_protestant std_q33_hhsize std_dependency_ratio, absorb(IDV_IDP) vce(cl IDV_house)	

	eststo: areg std_dyad_hosting std_emp_index std_q58_rel_chief std_q103_aid_sagree std_q104_cheaplabor_sagree std_good_roof std_good_walls std_asset_index std_q53_opinion std_q50_timeschurch std_male_head std_q43_home_ransacked std_visit3_hosting std_q105_resp_age std_literate std_q37_bornvillage std_protestant std_q33_hhsize std_dependency_ratio if dyad_sameethnicity_resp==1, absorb(IDV_IDP) vce(cl IDV_house)	

	eststo: areg std_dyad_hosting std_emp_index std_q58_rel_chief std_q103_aid_sagree std_q104_cheaplabor_sagree std_good_roof std_good_walls std_asset_index std_q53_opinion std_q50_timeschurch std_male_head std_q43_home_ransacked std_visit3_hosting std_q105_resp_age std_literate std_q37_bornvillage std_protestant std_q33_hhsize std_dependency_ratio if dyad_sameethnicity_resp==0, absorb(IDV_IDP) vce(cl IDV_house)	

	esttab using "TableA8.rtf", replace b(%6.3f) se(%6.3f) star(* 0.10 ** 0.05 *** 0.01) drop(_cons) nogaps label r2	
	
	


***************************
* Table A9: Correlates of Empathy
***************************

	use "03_Dataset_replication.dta",clear

	local groupid "std_ethnic_index"
	local chief "std_q58_rel_chief"
	local benefit "std_q103_aid_sagree std_q104_cheaplabor_sagree"
	local wealth "std_good_roof std_good_walls std_asset_index"
	local religiosity "std_q53_opinion std_q50_timeschurch"
	local security "std_male_head"
	local demograph "std_visit3_hosting std_q105_resp_age std_literate std_q37_bornvillage std_protestant std_q33_hhsize std_dependency_ratio"
	
	eststo clear	
	eststo: areg std_emp_index std_exposure_violence `groupid' `chief' `benefit' `wealth' `religiosity' `security' `demograph', absorb(IDV) vce(cl IDV)		
	eststo: areg std_emp_index std_q43_home_ransacked `groupid' `chief' `benefit' `wealth' `religiosity' `security' `demograph', absorb(IDV) vce(cl IDV)	
	eststo: areg std_emp_index std_q40_displaced `groupid' `chief' `benefit' `wealth' `religiosity' `security' `demograph' , absorb(IDV) vce(cl IDV)	
		
	esttab using "TableA9.rtf", replace b(%6.3f) se(%6.3f) star(* 0.10 ** 0.05 *** 0.01) drop(_cons) nogaps label r2 order(std_exposure_violence std_q43_home_ransacked std_q40_displaced) 
			


***************************
* Table A10: Experimental design
***************************

	use "03_Dataset_replication.dta",clear
	tab other_ethnicity appeal 


	
***************************
* Table A11: Experimental results
***************************

	use "03_Dataset_replication.dta",clear
	
	local empathy "emp_index"
	local groupid "ethnic_index"
	local chief "q58_rel_chief"
	local benefit "q103_aid_sagree q104_cheaplabor_sagree"
	local wealth "good_roof good_walls asset_index"
	local religiosity "q53_opinion q50_timeschurch"
	local security "male_head"
	local violence "q43_home_ransacked"
	local demograph "visit3_hosting q105_resp_age literate q37_bornvillage protestant q33_hhsize dependency_ratio"

		
	eststo clear
	eststo: areg list_accept T_empathy T_authority T_morality  other_ethnicity T_empathy_OTHER T_authority_OTHER T_morality_OTHER `empathy' `groupid' `chief' `benefit' `wealth' `religiosity' `security' `violence' `demograph' i.enumerator, absorb(IDV) vce(cl IDV)
	eststo: areg visit5or6_hosting_dk T_empathy T_authority T_morality  other_ethnicity T_empathy_OTHER T_authority_OTHER T_morality_OTHER `empathy' `groupid' `chief' `benefit' `wealth' `religiosity' `security' `violence' `demograph' i.enumerator, absorb(IDV) vce(cl IDV)
		
	esttab using "TableA11.rtf", replace b(%6.3f) r2 se(%6.3f) star(* 0.10 ** 0.05 *** 0.01) drop(_cons) nogaps label



***************************
* Table A12: Secondary outcomes - descriptives 
***************************

	use "03_Dataset_replication.dta",clear
	sum give_in_game list_work visit4_atfield 


***************************
* Table A13: Secondary outcomes - experimental results  
***************************

	use "03_Dataset_replication.dta",clear
	
	local empathy "emp_index"
	local groupid "ethnic_index"
	local chief "q58_rel_chief"
	local benefit "q103_aid_sagree q104_cheaplabor_sagree"
	local wealth "good_roof good_walls asset_index"
	local religiosity "q53_opinion q50_timeschurch"
	local security "male_head"
	local violence "q43_home_ransacked"
	local demograph "visit3_hosting q105_resp_age literate q37_bornvillage protestant q33_hhsize dependency_ratio"

		
	eststo clear 
	foreach v of varlist give_in_game list_work visit4_atfield  {
	eststo: areg `v' T_empathy T_authority T_morality other_ethnicity T_empathy_OTHER T_authority_OTHER T_morality_OTHER `empathy' `groupid' `chief' `benefit' `wealth' `religiosity' `security' `violence' `demograph', absorb(IDV) vce(cl IDV)
	}
	foreach v of varlist give_in_game list_work visit4_atfield  {
	eststo: areg `v' T_empathy T_authority T_morality other_ethnicity T_empathy_OTHER T_authority_OTHER T_morality_OTHER `empathy' `groupid' `chief' `benefit' `wealth' `religiosity' `security' `violence' `demograph' if likely_arrive==1 & field_true==1 & field_forIDP==1 , absorb(IDV) vce(cl IDV)		
	}	
	esttab using "TableA13.rtf", replace b(%6.3f) r2 se(%6.3f) star(* 0.10 ** 0.05 *** 0.01) drop(_cons) nogaps label

	

	
******************************************************************************** 
*** Supplementary Materials on APSR Dataverse 
********************************************************************************	
	

***************************
* Figure S1: Timing of new hosting relationships 
***************************	
	
	use "03_Dataset_replication.dta",clear
	
	hist months , percent discrete xlabel(0(1)10) xtitle(`"nr. of months after survey"') ytitle(`"% of hosting HH"')	
	graph export "FigureS1.png",replace

	
***************************
* Table S2: Hosting descriptives
***************************	
	
	use "03_Dataset_replication.dta",clear
	sum visit5or6_hosting visit5or6_hosting_dk
	sum villhost villhost_dk if village_level==1
	
***************************
* Figure S2: New hosting relationships at the village level 
***************************	
	
	use "03_Dataset_replication.dta",clear

	tab villhost if village_level==1
	tab villhost_dk if village_level==1
	
	hist villhost if village_level==1,percent bin(10) xtitle(`"% of HH that hosted incoming IDP"') xlabel(0(0.1)0.5) ylabel(0(10)40) yscale()
	graph save one,replace
	hist villhost_dk if village_level==1,percent bin(10) xtitle(`"% of HH that hosted incoming IDP stranger"') xlabel(0(0.1)0.5) ylabel(0(10)40)	
	graph save two,replace
	
	graph combine "one.gph" "two.gph" , imargin(zero) row(1)
	graph export "FigureS2.png",replace
	erase "one.gph" 
	erase "two.gph"


***************************
* Table S3: Attitudes towards IDPs
***************************		
	
	use "03_Dataset_replication.dta",clear
	sum q92_lazy q93_violent q94_trustworthy q95_witchcraft q96_christians q101_abuse q102_wayoflife attitudes
	
	
***************************
* Table S4: Correlates of attitudes towards IDPs
***************************		
	
	use "03_Dataset_replication.dta",clear

	local empathy "std_emp_index"
	local groupid "std_ethnic_index"
	local chief "std_q58_rel_chief"
	local benefit "std_q103_aid_sagree std_q104_cheaplabor_sagree"
	local wealth "std_good_roof std_good_walls std_asset_index"
	local religiosity "std_q53_opinion std_q50_timeschurch"
	local security "std_male_head"
	local violence "std_q43_home_ransacked"
	local demograph "std_visit3_hosting std_q105_resp_age std_literate std_q37_bornvillage std_protestant std_q33_hhsize std_dependency_ratio"

	eststo clear	
	eststo: areg std_attitudes `empathy' `groupid' `chief' `benefit' `wealth' `religiosity' `security' `violence' `demograph', absorb(IDV) vce(cl IDV)	
	
	esttab using "TableS4.rtf", replace b(%6.3f) se(%6.3f) star(* 0.10 ** 0.05 *** 0.01) drop(_cons) nogaps label r2 
		

	
***************************
* Figure S3: Histogram empathy items  
***************************	

	use "03_Dataset_replication.dta",clear
	
	hist q61_sad_03, freq ylabel(0(100)1000)
	graph export "FigureS3a.png",replace
	hist q62_caughtup_03, freq 
	graph export "FigureS3b.png",replace
	hist q63_scared_03, freq  
	graph export "FigureS3c.png",replace
	hist q65_understand_03, freq  
	graph export "FigureS3d.png",replace
	hist q66_angry_03, freq 
	graph export "FigureS3e.png",replace	


	
***************************
* Figure S4: Predicted probability of hosting by empathy score
***************************	

	use "03_Dataset_replication.dta",clear
		
	local empathy "std_emp_index"
	local groupid "std_ethnic_index"
	local chief "std_q58_rel_chief"
	local benefit "std_q103_aid_sagree std_q104_cheaplabor_sagree"
	local wealth "std_good_roof std_good_walls std_asset_index"
	local religiosity "std_q53_opinion std_q50_timeschurch"
	local security "std_male_head"
	local violence "std_q43_home_ransacked"
	local demograph "std_visit3_hosting std_q105_resp_age std_literate std_q37_bornvillage std_protestant std_q33_hhsize std_dependency_ratio"

	areg  visit5or6_hosting_dk `empathy' `groupid' `chief' `benefit' `wealth' `religiosity' `security' `violence' `demograph', absorb(IDV) vce(cl IDV)	
		
	margins, over(emp_index) atmeans
	marginsplot, ytitle("Predicted probability of hosting") xtitle("Empathy score") 
	graph export "FigureS4.png",replace


***************************
* Table S6: Balance
***************************

	use "03_Dataset_replication.dta",clear
	
	local vars "emp_index ethnic_index std_q58_rel_chief std_q103_aid_sagree std_q104_cheaplabor_sagree good_roof good_walls asset_index q53_opinion q50_timeschurch male_head q43_home_ransacked visit3_hosting q105_resp_age literate q37_bornvillage protestant q33_hhsize dependency_ratio"

	iebaltab `vars', group(appeal) savexlsx("TableS6.xlsx") fix(IDV) ft replace	
	
	
	
*** END ***	

